<template>
  <div class="about-we">
    <div class="container">
      <div class="imgaboutwe">
        <img v-lazy="aboutWeBackgroundimg" alt="" loading="lazy"/>
      </div>
      <div class="box" v-for="(item, index) in deptList" :key="index">
        <img v-lazy="item.image" alt="" loading="lazy"/>
        <div class="numbertext">
          {{ item.description }}
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { queryDetailsAll } from "@/api/departmentalServices/department";
export default {
  name: "deptList",
  data() {
    return {
      detailsList: [], //轮播图数据
    };
  },
  props: {
    //numberList[0]是老师，numberList[1]是学生
    deptList: {
      type: Array,
      required: true,
    },
    aboutWeBackgroundimg: {
      type: String,
      required: true,
    },
  },
  mounted() {
    // this.getDetailsAll();
    console.log("aboutWe");
  },
  methods: {
    //获取部门详细信息
/*     getDetailsAll() {
      queryDetailsAll().then((res) => {
        if (res.code == 20000) {
          this.detailsList = res.data.deptDetails;
        }
      });
    }, */
  },
};
</script>

<style scoped>
body {
  background-color: rgb(243, 236, 226);
  font-family: Arial, sans-serif;

  display: flex;

  align-items: center;
  height: 100vh;
  margin: 0;
}
.imgaboutwe {
  margin-top: 150px;
  width: 550px;
  height: 550px;
  /* margin-left: 20px; */
  margin-right: 40px;
}
.imgaboutwe img {
  width: 70%;
}
.numbertext {
  opacity: 0;

  white-space: wrap;
  position: absolute;

  display: none;
  width: 100%;
}
.box:hover:nth-child(odd) .numbertext {
  animation-name: textUp;
  animation-duration: 2s;
  animation-fill-mode: both;
  opacity: 1;
  top: 0;
  display: block;
}
.box:not(:hover):nth-child(odd) .numbertext {
  animation-name: textUptwo;
  animation-duration: 2s;
  animation-fill-mode: both;
}
.box:hover:nth-child(even) .numbertext {
  animation-name: textDown;
  animation-duration: 2s;
  animation-fill-mode: both;
  opacity: 1;
  bottom: 0;
  display: block;
}
.box:not(:hover):nth-child(even) .numbertext {
  animation-name: textDowntwo;
  animation-duration: 2s;
  animation-fill-mode: both;
}

.container {
  display: flex;
  justify-content: flex-start; /* 修改为靠左对齐 */
  text-align: center;
  margin-top: 50px;
}

h1 {
  font-size: 4em;
  color: black;
  margin-bottom: 20px;
}

.box {
  margin-right: 70px;
  width: 300px;
  height: 500px;
  background-color: white;
  position: relative;
  transition: transform 0.5s ease;
}

.box:nth-child(odd) {
  animation-name: fadeInUp;
  animation-duration: 1.5s;
  animation-fill-mode: both;
  box-shadow: 16px 8px 6px rgba(0, 0, 0, 0.3);
}
.box img {
  transition: all 0.5s ease;
  width: 100%;
  height: 100%;
}
.box:nth-child(odd):hover img {
  animation-name: imgUp;
  animation-duration: 1s;
  animation-fill-mode: both;
}
.box:nth-child(odd):not(:hover) img {
  animation-name: imgUptwo;
  animation-duration: 1s;
  animation-fill-mode: both;
}
.box:nth-child(even):hover img {
  animation-name: imgDown;
  animation-duration: 1s;
  animation-fill-mode: both;
}
.box:nth-child(even):not(:hover) img {
  animation-name: imgDowntwo;
  animation-duration: 1s;
  animation-fill-mode: both;
}

.box:nth-child(even) {
  box-shadow: 16px 8px 6px rgba(0, 0, 0, 0.3);
  animation-name: fadeInDown;
  animation-duration: 1.5s;
  animation-fill-mode: both;
}

@keyframes fadeInUp {
  from {
    transform: translateY(-400px);
    opacity: 0;
  }
  to {
    transform: translateY(0px);
    opacity: 1;
  }
}

@keyframes fadeInDown {
  from {
    transform: translateY(400px);
    opacity: 0;
  }
  to {
    transform: translateY(100px);
    opacity: 1;
  }
}

@keyframes imgUp {
  from {
    transform: translateY(0px);
  }
  to {
    transform: translateY(100px);
  }
}
@keyframes imgUptwo {
  from {
    transform: translateY(100px);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes imgDown {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-100px);
  }
}
@keyframes imgDowntwo {
  from {
    transform: translateY(-100px);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes textUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
@keyframes textUptwo {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(50px);
    opacity: 0;
  }
}
@keyframes textDown {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
@keyframes textDowntwo {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(-50px);
    opacity: 0;
  }
}
</style>
